AmCharts.GaugeAxis=AmCharts.Class({construct:function(t){this.cname="GaugeAxis";this.radius="95%";this.labelsEnabled=!0;this.startAngle=-120;this.endAngle=120;this.startValue=0;this.endValue=200;this.gridCount=5;this.tickLength=10;this.minorTickLength=5;this.tickColor="#555555";this.labelFrequency=this.tickThickness=this.tickAlpha=1;this.inside=!0;this.labelOffset=10;this.showLastLabel=this.showFirstLabel=!0;this.axisThickness=1;this.axisColor="#000000";this.axisAlpha=1;this.gridInside=!0;this.topTextYOffset=0;this.topTextBold=!0;this.bottomTextYOffset=0;this.bottomTextBold=!0;this.centerY=this.centerX="0%";this.bandOutlineAlpha=this.bandOutlineThickness=0;this.bandOutlineColor="#000000";this.bandAlpha=1;this.bcn="gauge-axis";AmCharts.applyTheme(this,t,"GaugeAxis")},value2angle:function(t){return(t-this.startValue)/(this.endValue-this.startValue)*(this.endAngle-this.startAngle)+this.startAngle},setTopText:function(t){if(void 0!==t){this.topText=t;var s=this.chart;if(this.axisCreated){this.topTF&&this.topTF.remove();var i=this.topTextFontSize;i||(i=s.fontSize);var a=this.topTextColor;a||(a=s.color);t=AmCharts.text(s.container,t,a,s.fontFamily,i,void 0,this.topTextBold);AmCharts.setCN(s,t,"axis-top-label");t.translate(this.centerXReal,this.centerYReal-this.radiusReal/2+this.topTextYOffset);this.set.push(t);this.topTF=t}}},setBottomText:function(t){if(void 0!==t){this.bottomText=t;var s=this.chart;if(this.axisCreated){this.bottomTF&&this.bottomTF.remove();var i=this.bottomTextFontSize;i||(i=s.fontSize);var a=this.bottomTextColor;a||(a=s.color);t=AmCharts.text(s.container,t,a,s.fontFamily,i,void 0,this.bottomTextBold);AmCharts.setCN(s,t,"axis-bottom-label");t.translate(this.centerXReal,this.centerYReal+this.radiusReal/2+this.bottomTextYOffset);this.bottomTF=t;this.set.push(t)}}},draw:function(){var t=this.chart,s=t.container.set();this.set=s;AmCharts.setCN(t,s,this.bcn);AmCharts.setCN(t,s,this.bcn+"-"+this.id);t.graphsSet.push(s);var i=this.startValue,a=this.endValue,e=this.valueInterval;isNaN(e)&&(e=(a-i)/this.gridCount);var h=this.minorTickInterval;isNaN(h)&&(h=e/5);var r=this.startAngle,o=this.endAngle,n=this.tickLength,a=(a-i)/e+1,l=(o-r)/(a-1),u=l/e;this.singleValueAngle=u;var d=t.container,c=this.tickColor,m=this.tickAlpha,A=this.tickThickness,h=e/h,g=l/h,C=this.minorTickLength,f=this.labelFrequency,x=this.radiusReal;this.inside||(x-=15);var p=t.centerX+AmCharts.toCoordinate(this.centerX,t.realWidth),v=t.centerY+AmCharts.toCoordinate(this.centerY,t.realHeight);this.centerXReal=p;this.centerYReal=v;var w={fill:this.axisColor,"fill-opacity":this.axisAlpha,"stroke-width":0,"stroke-opacity":0},b,N;this.gridInside?N=b=x:(b=x-n,N=b+C);var T=this.bands;if(T)for(var M=0;M<T.length;M++){var B=T[M];if(B){var k=B.startValue,V=B.endValue,R=AmCharts.toCoordinate(B.radius,x);isNaN(R)&&(R=N);var F=AmCharts.toCoordinate(B.innerRadius,x);isNaN(F)&&(F=R-C);var I=r+u*(k-this.startValue),V=u*(V-k),O=B.outlineColor;void 0==O&&(O=this.bandOutlineColor);var P=B.outlineThickness;isNaN(P)&&(P=this.bandOutlineThickness);var S=B.outlineAlpha;isNaN(S)&&(S=this.bandOutlineAlpha);k=B.alpha;isNaN(k)&&(k=this.bandAlpha);R=AmCharts.wedge(d,p,v,I,V,R,R,F,0,{fill:B.color,stroke:O,"stroke-width":P,"stroke-opacity":S});AmCharts.setCN(t,R.wedge,"axis-band");void 0!=B.id&&AmCharts.setCN(t,R.wedge,"axis-band-"+B.id);R.setAttr("opacity",k);this.set.push(R);this.addEventListeners(R,B)}}u=this.axisThickness/2;o=AmCharts.wedge(d,p,v,r,o-r,b+u,b+u,b-u,0,w);AmCharts.setCN(t,o.wedge,"axis-line");s.push(o);o=AmCharts.doNothing;AmCharts.isModern||(o=Math.round);e=AmCharts.roundTo(e,14);u=AmCharts.getDecimals(e);for(w=0;w<a;w++)if(T=i+w*e,b=r+w*l,M=o(p+x*Math.sin(b/180*Math.PI)),B=o(v-x*Math.cos(b/180*Math.PI)),R=o(p+(x-n)*Math.sin(b/180*Math.PI)),F=o(v-(x-n)*Math.cos(b/180*Math.PI)),M=AmCharts.line(d,[M,R],[B,F],c,m,A,0,!1,!1,!0),AmCharts.setCN(t,M,"axis-tick"),s.push(M),M=-1,R=this.labelOffset,this.inside||(R=-R-n,M=1),B=Math.sin(b/180*Math.PI),F=Math.cos(b/180*Math.PI),B=p+(x-n-R)*B,R=v-(x-n-R)*F,k=this.fontSize,isNaN(k)&&(k=t.fontSize),F=Math.sin((b-90)/180*Math.PI),I=Math.cos((b-90)/180*Math.PI),0<f&&this.labelsEnabled&&w/f==Math.round(w/f)&&(this.showLastLabel||w!=a-1)&&(this.showFirstLabel||0!==w)&&(V=this.usePrefixes?AmCharts.addPrefix(T,t.prefixesOfBigNumbers,t.prefixesOfSmallNumbers,t.nf,!0):AmCharts.formatNumber(T,t.nf,u),(O=this.unit)&&(V="left"==this.unitPosition?O+V:V+O),(O=this.labelFunction)&&(V=O(T)),T=AmCharts.text(d,V,t.color,t.fontFamily,k),AmCharts.setCN(t,T,"axis-label"),k=T.getBBox(),T.translate(B+M*k.width/2*I,R+M*k.height/2*F),s.push(T)),w<a-1)for(T=1;T<h;T++)F=b+g*T,M=o(p+N*Math.sin(F/180*Math.PI)),B=o(v-N*Math.cos(F/180*Math.PI)),R=o(p+(N-C)*Math.sin(F/180*Math.PI)),F=o(v-(N-C)*Math.cos(F/180*Math.PI)),M=AmCharts.line(d,[M,R],[B,F],c,m,A,0,!1,!1,!0),AmCharts.setCN(t,M,"axis-tick-minor"),s.push(M);this.axisCreated=!0;this.setTopText(this.topText);this.setBottomText(this.bottomText);t=t.graphsSet.getBBox();this.width=t.width;this.height=t.height},addEventListeners:function(t,s){var i=this.chart;t.mouseover(function(t){i.showBalloon(s.balloonText,s.color,!0)}).mouseout(function(t){i.hideBalloon()})}});AmCharts.GaugeArrow=AmCharts.Class({construct:function(t){this.cname="GaugeArrow";this.color="#000000";this.nailAlpha=this.alpha=1;this.startWidth=this.nailRadius=8;this.endWidth=0;this.borderAlpha=1;this.radius="90%";this.nailBorderAlpha=this.innerRadius=0;this.nailBorderThickness=1;this.frame=0;AmCharts.applyTheme(this,t,"GaugeArrow")},setValue:function(t){var s=this.chart;s?s.setValue?s.setValue(this,t):this.previousValue=this.value=t:this.previousValue=this.value=t}});AmCharts.GaugeBand=AmCharts.Class({construct:function(){this.cname="GaugeBand"}});AmCharts.AmAngularGauge=AmCharts.Class({inherits:AmCharts.AmChart,construct:function(t){this.cname="AmAngularGauge";AmCharts.AmAngularGauge.base.construct.call(this,t);this.theme=t;this.type="gauge";this.minRadius=this.marginRight=this.marginBottom=this.marginTop=this.marginLeft=10;this.faceColor="#FAFAFA";this.faceAlpha=0;this.faceBorderWidth=1;this.faceBorderColor="#555555";this.faceBorderAlpha=0;this.arrows=[];this.axes=[];this.startDuration=1;this.startEffect="easeOutSine";this.adjustSize=!0;this.extraHeight=this.extraWidth=0;AmCharts.applyTheme(this,t,this.cname)},addAxis:function(t){this.axes.push(t)},formatString:function(t,s){return t=AmCharts.formatValue(t,s,["value"],this.nf,"",this.usePrefixes,this.prefixesOfSmallNumbers,this.prefixesOfBigNumbers)},initChart:function(){AmCharts.AmAngularGauge.base.initChart.call(this);var t;0===this.axes.length&&(t=new AmCharts.GaugeAxis(this.theme),this.addAxis(t));var s;for(s=0;s<this.axes.length;s++)t=this.axes[s],t=AmCharts.processObject(t,AmCharts.GaugeAxis,this.theme),t.id||(t.id="axisAuto"+s+"_"+(new Date).getTime()),t.chart=this,this.axes[s]=t;var i=this.arrows;for(s=0;s<i.length;s++){t=i[s];t=AmCharts.processObject(t,AmCharts.GaugeArrow,this.theme);t.id||(t.id="arrowAuto"+s+"_"+(new Date).getTime());t.chart=this;i[s]=t;var a=t.axis;AmCharts.isString(a)&&(t.axis=AmCharts.getObjById(this.axes,a));t.axis||(t.axis=this.axes[0]);isNaN(t.value)&&t.setValue(t.axis.startValue);isNaN(t.previousValue)&&(t.previousValue=t.axis.startValue)}this.setLegendData(i);this.drawChart();this.totalFrames=1e3*this.startDuration/AmCharts.updateRate},drawChart:function(){AmCharts.AmAngularGauge.base.drawChart.call(this);var t=this.container,s=this.updateWidth();this.realWidth=s;var i=this.updateHeight();this.realHeight=i;var a=AmCharts.toCoordinate,e=a(this.marginLeft,s),h=a(this.marginRight,s),r=a(this.marginTop,i)+this.getTitleHeight(),o=a(this.marginBottom,i),n=a(this.radius,s,i),a=s-e-h,l=i-r-o+this.extraHeight;n||(n=Math.min(a,l)/2);n<this.minRadius&&(n=this.minRadius);this.radiusReal=n;this.centerX=(s-e-h)/2+e;this.centerY=(i-r-o)/2+r+this.extraHeight/2;isNaN(this.gaugeX)||(this.centerX=this.gaugeX);isNaN(this.gaugeY)||(this.centerY=this.gaugeY);var s=this.faceAlpha,i=this.faceBorderAlpha,u;if(0<s||0<i)u=AmCharts.circle(t,n,this.faceColor,s,this.faceBorderWidth,this.faceBorderColor,i,!1),u.translate(this.centerX,this.centerY),u.toBack(),(t=this.facePattern)&&u.pattern(t);for(s=n=t=0;s<this.axes.length;s++)i=this.axes[s],e=i.radius,i.radiusReal=AmCharts.toCoordinate(e,this.radiusReal),i.draw(),h=1,-1!==String(e).indexOf("%")&&(h=1+(100-Number(e.substr(0,e.length-1)))/100),i.width*h>t&&(t=i.width*h),i.height*h>n&&(n=i.height*h);(s=this.legend)&&s.invalidateSize();if(this.adjustSize&&!this.chartCreated){u&&(u=u.getBBox(),u.width>t&&(t=u.width),u.height>n&&(n=u.height));u=0;if(l>n||a>t)u=Math.min(l-n,a-t);0<u&&(this.extraHeight=l-n,this.chartCreated=!0,this.validateNow())}a=this.arrows.length;for(s=0;s<a;s++)l=this.arrows[s],l.drawnAngle=NaN;this.dispDUpd();this.chartCreated=!0},validateSize:function(){this.extraHeight=this.extraWidth=0;this.chartCreated=!1;AmCharts.AmAngularGauge.base.validateSize.call(this)},addArrow:function(t){this.arrows.push(t)},removeArrow:function(t){AmCharts.removeFromArray(this.arrows,t);this.validateNow()},removeAxis:function(t){AmCharts.removeFromArray(this.axes,t);this.validateNow()},drawArrow:function(t,s){t.set&&t.set.remove();var i=this.container;t.set=i.set();AmCharts.setCN(this,t.set,"gauge-arrow");AmCharts.setCN(this,t.set,"gauge-arrow-"+t.id);if(!t.hidden){var a=t.axis,e=a.radiusReal,h=a.centerXReal,r=a.centerYReal,o=t.startWidth,n=t.endWidth,l=AmCharts.toCoordinate(t.innerRadius,a.radiusReal),u=AmCharts.toCoordinate(t.radius,a.radiusReal);a.inside||(u-=15);var d=t.nailColor;d||(d=t.color);var c=t.nailColor;c||(c=t.color);d=AmCharts.circle(i,t.nailRadius,d,t.nailAlpha,t.nailBorderThickness,d,t.nailBorderAlpha);AmCharts.setCN(this,d,"gauge-arrow-nail");t.set.push(d);d.translate(h,r);isNaN(u)&&(u=e-a.tickLength);var a=Math.sin(s/180*Math.PI),e=Math.cos(s/180*Math.PI),d=Math.sin((s+90)/180*Math.PI),m=Math.cos((s+90)/180*Math.PI),i=AmCharts.polygon(i,[h-o/2*d+l*a,h+u*a-n/2*d,h+u*a+n/2*d,h+o/2*d+l*a],[r+o/2*m-l*e,r-u*e+n/2*m,r-u*e-n/2*m,r-o/2*m-l*e],t.color,t.alpha,1,c,t.borderAlpha,void 0,!0);AmCharts.setCN(this,i,"gauge-arrow");t.set.push(i);this.graphsSet.push(t.set)}},setValue:function(t,s){t.axis&&t.axis.value2angle&&(t.axis.value2angle(s),t.frame=0,t.previousValue=t.value);t.value=s;var i=this.legend;i&&i.updateValues()},handleLegendEvent:function(t){var s=t.type;t=t.dataItem;if(!this.legend.data&&t)switch(s){case"hideItem":this.hideArrow(t);break;case"showItem":this.showArrow(t)}},hideArrow:function(t){t.set.hide();t.hidden=!0},showArrow:function(t){t.set.show();t.hidden=!1},updateAnimations:function(){AmCharts.AmAngularGauge.base.updateAnimations.call(this);for(var t=this.arrows.length,s,i=0;i<t;i++){s=this.arrows[i];var a;s.frame>=this.totalFrames?a=s.value:(s.frame++,s.clockWiseOnly&&s.value<s.previousValue&&(a=s.axis,s.previousValue-=a.endValue-a.startValue),a=AmCharts.getEffect(this.startEffect),a=AmCharts[a](0,s.frame,s.previousValue,s.value-s.previousValue,this.totalFrames),isNaN(a)&&(a=s.value));a=s.axis.value2angle(a);s.drawnAngle!=a&&(this.drawArrow(s,a),s.drawnAngle=a)}}});
//# sourceMappingURL=gauge.map.js